<%@ page import="com.google.appengine.api.users.User"%>
<%@ page import="com.google.appengine.api.users.UserService"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<title>Index</title>
</head>
<body>
	<%
		UserService userService = UserServiceFactory.getUserService();
		User user = userService.getCurrentUser();
		if (user != null)
		{
			pageContext.setAttribute("user", user);
	%>
	<nav>
		<ul>
			<li><a href="<%=request.getContextPath()%>/jsp/home.jsp" target="iframe1">Home</a></li>
			<li><a href="/TvBroadcastServlet?action=viewTvChoices" target="iframe1">TV</a></li>
			<li><a href="/CellularBroadcastServlet?action=viewCellularChoices" target="iframe1">Cellular</a></li>
			<li><a href="/RadioBroadcastServlet?action=viewRadioChoices" target="iframe1">Radio</a></li>
			<li><a href="<%=userService.createLogoutURL(request.getRequestURI()) %>">Sign Out</a></li>
		</ul>
	</nav>
	<div id="content">
		<iframe name="iframe1" src="<%=request.getContextPath()%>/jsp/home.jsp" seamless="seamless" width="100%" height="95%"></iframe>
	</div>
	<%
		} else
		{
	%>
	<p>
		Hello! <a href="<%=userService.createLoginURL(request.getRequestURI())%>">Sign in</a>
	</p>
	<%
		}
	%>
</body>
</html>
